<?php

/**
 * Name: 系统控制器controller
 * User: Wudean
 * Date: 2018/05/16
 */
namespace App\Http\Controllers\Mapi;
use App\Http\Controllers\Controller;
use App\Services\WxLoginService;
use Illuminate\Http\Request;
use App\Api\Helper\ReturnMessage;

class LoginController extends Controller
{

    /**
     * @param Request $request
     * @return \Dingo\Api\Http\Response
     * @name 小程序登录处理
     * @user IHammer
     */
    public function wxLogin(Request $request){
        $errmsg = "操作错误！";
        $token = WxLoginService::wxLoginHandle($request,$errmsg);
        if($token){
            return ReturnMessage::successData($token);
        }
        return ReturnMessage::success($errmsg);

    }
}
